package main

import (
	"math/rand"
	"fmt"
)

func main() {
	c := make(chan int, 1)
	for {
		select {
		case v, ok := <-c:
			if !ok {
				c <- rand.Intn(100)
				go Go(c)
			}
			fmt.Println("father:",v)
		}
	}

}

func Go(c chan int) {
	fmt.Println("children:",<-c)
	c<-rand.Intn(100)
}
